# -*- coding: utf-8 -*-
# @Time    : 2022/1/16 23:08
# @Author  : mzp
# @Email   : 2609404548@qq.com
# @File    : page_Share dishes.py
# @Software: PyCharm
from time import sleep

from appium import webdriver
from selenium.webdriver.common.by import By

from pages.page_base import PageBase


class Addwork(PageBase):
    """验证添加作品"""
    addwork_agreement_locator=(111,749)#同意协议
    addwork_determine_locator = (342, 817)  # 确定
    addwork_plus_locator=(352,1216) #"+"
    addwork_work_locator=(213,1066)#晒作品
    addwork_qq_locator = (469, 1205)  # 点击QQ
    addwork_jurisdiction_locator = (356, 1120)  # 进行授权
    addwork_plus1_locator = (352, 1216)  # "+"
    addwork_work1_locator = (213, 1066)  # 晒作品
    addwork_picture_locator=(322,136)#选择图片
    addwork_next_step_locator=(606,1226) #下一步
    addwork_next_step1_locator = (635,1236) # 再下一步
    addwork_title_locator=('new UiSelector().text("写个标题吧")') #菜品名
    addworl_release_locator=('new UiSelector().text("发布")') #发布
    addworl_agree_locator=('new UiSelector().text("同意")') #同意
    addworl_cancel_locator=('new UiSelector().text("取消")')#取消
    addworl_my_locator=('new UiSelector().text("我的")') #我的
    addworl_work_locator=('new UiSelector().text("作品")')#作品

    def ele_addwork_agreement(self):
        """同意协议"""
        self.driver.tap([(111,749)])
        sleep(4)
    def ele_addwork_determine(self):
        """确定"""
        self.driver.tap([(342,817)])
        sleep(9)

    def ele_addwork_plus(self):
        """+"""
        self.driver.tap([(352,1216)])
        sleep(9)

    def ele_addwork_work(self):
        """晒作品"""
        self.driver.tap([(213,1066)])
        sleep(9)

    def ele_addwork_qq(self):
        """点击QQ"""
        self.driver.tap([(469, 1205)])
        sleep(9)
    def ele_addwork_jurisdiction(self):
        """进行授权"""
        self.driver.tap([(356, 1120)])
        sleep(9)
    def ele_addwork_plus1(self):
        '''+'''
        self.driver.tap([(352, 1216)])
        sleep(9)
    def ele_addwork_work1(self):
        '''晒作品'''
        self.driver.tap([(213, 1066)])
        sleep(9)
    def ele_addwork_picture(self):
        '''选择图片'''
        self.driver.tap([(322,136)])
        sleep(9)
    def ele_addwork_next_step(self):
        '''下一步'''
        self.driver.tap([(606,1226)])
        sleep(9)
    def ele_addwork_next_step1(self):
        '''再下一步'''
        self.driver.tap([(635,1236)])
        sleep(9)
    def ele_addwork_title(self):
        '''输入菜品名'''
        self.driver.find_element_by_android_uiautomator('new UiSelector().text("写个标题吧")').send_keys("怪味面")
        sleep(9)
    def ele_addworl_release(self):
        '''发布'''
        self.driver.find_element_by_android_uiautomator('new UiSelector().text("发布")').click()
        sleep(9)
    def ele_addworl_agree(self):
        '''同意'''
        self.driver.find_element_by_android_uiautomator('new UiSelector().text("同意")').click()
        sleep(9)
    def ele_addworl_cancel(self):
        '''取消'''
        self.driver.find_element_by_android_uiautomator('new UiSelector().text("取消")').click()
        sleep(9)
    def ele_addworl_my(self):
        '''我的'''
        self.driver.find_element_by_android_uiautomator('new UiSelector().text("我的")').click()
        sleep(9)
    def ele_addworl_work(self):
        '''作品'''
        self.driver.find_element_by_android_uiautomator('new UiSelector().text("作品")').click()
    def group(self):
        self.ele_addwork_agreement()
        self.ele_addwork_determine()
        self.ele_addwork_plus()
        self.ele_addwork_work()
        self.ele_addwork_qq()
        self.ele_addwork_jurisdiction()
        self.ele_addwork_plus1()
        self.ele_addwork_work1()
        self.ele_addwork_picture()
        self.ele_addwork_next_step()
        self.ele_addwork_next_step1()
        self.ele_addwork_title()
        self.ele_addworl_release()
        self.ele_addworl_agree()
        self.ele_addworl_cancel()
        self.ele_addworl_my()
        self.ele_addworl_work()